# encoding: utf-8
# @File   : request_utils.py
# @Author : 乖孩子
# @Date   : 2025/05/07 14:56:32
# utils/request_utils.py
import requests
from config.config import BASE_URL

class RequestUtils:
    def __init__(self):
        self.base_url = BASE_URL

    def send_request(self, method, url, headers=None, params=None, json=None):
        full_url = self.base_url + url
        try:
            response = requests.request(method, full_url, headers=headers, params=params, json=json)
            response.raise_for_status()
            return response.json()
        except requests.RequestException as e:
            print(f"请求出错: {e}")
            return None